package com.hyq.learn.web.config;

import com.hyq.learn.web.env.LearnEnvironment;
import com.hyq.learn.web.listenen.ApplicationCloseListener;
import com.hyq.learn.web.listenen.ApplicationFailedListener;
import com.hyq.learn.web.listenen.ApplicationStartListener;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author heyuqin
 * @date 2024/5/27 17:26
 */
@Configuration
@ConditionalOnClass(value = {ApplicationStartListener.class})
public class LearnListenerAutoConfig {

    @Bean
    public ApplicationStartListener applicationStartListener(LearnEnvironment learnEnvironment){
        return new ApplicationStartListener(learnEnvironment);
    }

    @Bean
    public ApplicationFailedListener applicationFailedListener(LearnEnvironment learnEnvironment){
        return new ApplicationFailedListener(learnEnvironment);
    }

    @Bean
    public ApplicationCloseListener applicationCloseListener(LearnEnvironment learnEnvironment){
        return new ApplicationCloseListener();
    }


}
